﻿using SharedKernel.Domain;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace SharedKernel.Infrastructure.Repositories
{
    /// <summary>
    /// SqlSugar仓储接口
    /// 仓储主要是为了解耦，将数据访问层与业务逻辑层分离。避免切换ORM导致很多地方代码都需要修改。
    /// </summary>
    /// <typeparam name="TEntity">实体类型</typeparam>
    /// <typeparam name="TId">实体主键类型</typeparam>
    public interface ISqlSugarRepository<TEntity, TId> : IRepository<TEntity, TId> where TEntity : BaseId<TId>, new() where TId : IEquatable<TId>
    {
        /// <summary> 
        /// 实体集合
        /// </summary>
        ISugarQueryable<TEntity> Entities { get; }

        /// <summary>
        /// 数据库上下文
        /// </summary>
        SqlSugarClient Context { get; }

        /// <summary>
        ///  
        /// </summary>
        IAdo Ado { get; }

    }
}

